‹#›
Inventor API 中的零件图、部件图和工程图
增加部件范例
‘Before running this code, open an assembly file
Public Sub AddFromFile()
Dim oDoc As AssemblyDocument
oDoc = _InvApplication.ActiveDocument
Dim oMatrix As Matrix
oMatrix = _InvApplication.TransientGeometry.CreateMatrix
Dim oOcc As ComponentOccurrence
oOcc = oDoc.ComponentDefinition.Occurrences.Add("C:\Temp\Part1.ipt", oMatrix)
End Sub
Public Sub AddFromMemory()
Dim oDoc As AssemblyDocument
oDoc = _InvApplication.ActiveDocument
Dim oPartDoc As PartDocument
oPartDoc = _InvApplication.Documents.Add(kPartDocumentObject, False)
Dim oMatrix As Matrix
oMatrix = _InvApplication.TransientGeometry.CreateMatrix
Dim oOcc As ComponentOccurrence
oOcc = oDoc.ComponentDefinition.Occurrences.AddByComponentDefinition( _
oPartDoc.ComponentDefinition, oMatrix)
End Sub